home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d1 / int_23.arc / INT23TST.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-03-15  |  552 b   |  33 lines

  1. /*    This code comes from a complete ARC file with a demonstration program and
  2.     documentation.  If you do not have the whole ARC, it is available from the
  3.     MSOFT forum on CompuServe.
  4. */
  5.  
  6. #include <dos.h>
  7. #include <signal.h>
  8.  
  9. int mygetch()
  10. {
  11.     void int23();
  12.     int c;
  13.     
  14.     if ((c = bdos(7, 0, 0) & 0x00FF) == 0x03) int23();
  15.     else return c;
  16. }
  17.  
  18. void handler()
  19. {
  20.     void printf();
  21.  
  22.     printf("Got ^C");
  23.     signal(SIGINT, handler);
  24. }
  25.  
  26. void main()
  27. {
  28.     int c;
  29.  
  30.     signal(SIGINT, handler);
  31.     while((c = mygetch()) != 26) printf("%02x", c);
  32. }
  33.